{% load bootstrap4 %}

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Learning Log 学习笔记主页</title>

    {% bootstrap_css %}
    {% bootstrap_javascript jquery='full' %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <a class="navbar-brand" href="{% url 'learning_logs:index' %}">Learning Log</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                <a class="nav-link" href="{% url 'learning_logs:topics' %}">Topics<span class="sr-only">(current)</span></a>
            </li>
        </ul>
        <ul class="navbar-nav mr-auto">
            {% if user.is_authenticated %}<!-- 用户已登录时的显示 -->
                <li class="nav-item active">
                    <span class="navbar-text">Hello, {{ user.username }}.</span>
                </li>
                <li class="nav-item active">
                    <a class="nav-link" href="{% url 'users:logout' %}">登出</a>
                </li>
            {% else %}<!-- 用户未登录时的显示 -->
                <li class="nav-item active">
                    <a class="nav-link" href="{% url 'users:register' %}">您还未登录，点击注册</a>
                </li>
                <li class="nav-item active">
                    <a class="nav-link" href="{% url 'users:login' %}"><font color="red">已有账户？点击登录</font></a>
                </li>
            {% endif %}
        </ul>
        <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="search" placeholder="可以在这搜索" aria-label="Search">
            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
        </form>
    </div>
</nav>

<main role="main" class="container"><!-- main是一个起始标签，用于定义页面主体的最重要部分。此处指定了Bootstrap选择器container -->
    <div class="pb-2 mb-2 border-bottom"><!-- p是padding内边距，pb是下内边距；m是margin外边距，mb是下外边距-->
        {% block page_header %}{% endblock page_header %}
    </div>
    <div>
        {% block content %}{% endblock content %}
    </div>
</main>
</body>
</html>
